<!DOCTYPE html>
<html>
<body>
<script src="../../../resources/js-test.js"></script>
<input list="d" id="input1">
<datalist id="d">
</datalist>
<script>
description('We should restore selection after datalist availability change.');
var input1 = document.querySelector('#input1');
input1.focus();
document.querySelector('datalist').innerHTML = '<option value="a"></option>';
document.execCommand('inserttext', false, 'abc');
shouldBeEqualToString('input1.value', 'abc');
</script>
</body>
</html>
